<html>
	<head>
        <title>登陆页面</title>
        <meta http-equiv="Content-Type" content="text/html;"  charset="utf-8">
 		<link rel="shortcut icon" href="/NEOS/logo.png" type="image/x-icon" />
        <link rel="stylesheet" href="/NOES/css/login_style.css"/>
        <link rel="shortcut icon" href="logo.png" type="image/x-icon" />
		<script type="text/javascript" src="/NOES/jquery-1.6.4.js"></script>
		<script type="text/javascript" src="/NOES/js/jquery.md5.js"></script>
		<script type="text/javascript" src="/NOES/js/NOES_function.js"></script>
		<script type="text/javascript">
		<bgcolor="blue">
			$(window).load(function(){ 
				document.oncontextmenu = nocontextmenu;
				document.onmousedown = norightclick;
				document.onselectstart = function(){return false};
			});
			function login(){
				$.ajax({
					type:'POST',
					url:'loginCheck.action',
					data: {
						id : $('#id').val() ,
						password : $('#password').val() ,
						varInput : $('#varInput').val()
					},
					error:function(){
						$('#error').html('帐号不存在');
						$('#id').focus();
					},
					success:function(data){
						if( data == "success" ){
							var id = $('#id').val();
							var temp = $('#password').val();
							var password = $.md5( temp );
							//window.location.replace("forward.action?id="+id+"&password="+password) ;
							//window.location.href="forward.action?id="+id+"&password="+password;
							$('#fid').attr('value',id);
							$('#fpassword').attr('value',password);
							$('#form').submit();
						}else{
							$('#error').html(data);
						}
					}
				});
		  	}
			function flush(){
		  		var rndImg = document.getElementById('rndImg');
				rndImg.setAttribute('src', 'randomImage');
		  	}
		  	function checkInput(){
		  		if( $('#id').val() == "" ){
		  			$('#error').html('帐号输入不能空');
		  			$('#id').focus();
		  			return ;
		  		}else if( $("#password").val() == "" ){
		  			$('#error').html('密码输入不能空');
		  			$('#password').focus();
		  			return ;
		  		}else if( $("#varInput").val() == "" ){
		  			$('#error').html('验证码输入不能空');
		  			$('#varInput').focus();
		  		}else{
		  			login();
		  		}
		  	}
			$(function(){
				$('#id').focus();
				
			});
			function nocontextmenu() {
				event.cancelBubble = true;
				event.returnValue = false;
				return false;
			}
			function norightclick(e) {
				if (window.Event){
			   	if (e.which == 2 || e.which == 3)
			   	return false;
				}else{
			   	if (event.button == 2 || event.button == 3){
				   	event.cancelBubble = true;
						event.returnValue = false;
				   	return false;
					}
				}
			}
		</script>
    </head>
    <body> 
    	<div id="center">
        	<h1>中山大学南方学院<span>在线考试系统</span></h1>
            <div id="content">
            	<div id="center">
                	<p id="temp">请使用有效帐号进行登陆</p>
                	<table>
                		<tr>
                			<td>
                				<label>帐&nbsp;&nbsp;号：</label>
                    			<input type="text" size="30" class="text" id="id"/>
                			</td>
                		</tr>
                		<tr>
                			<td>
                				<label>密&nbsp;&nbsp;码：</label>
                    			<input type="password" size="30" class="text" id="password"/>
                			</td>
                		</tr>
                		<tr>
                			<td>
                				<label>验证码：</label>
                    			<input type="text" size="19" class="text" id="varInput"/>
                    			<img src="randomImage" onclick="flush()" id="rndImg" style="cursor:pointer;cursor:hand;"/>
                			</td>
                		</tr>
                		<tr align="right">
                			<td>
                				<span id="error" style="color: red;font-weight: bold;">&nbsp;</span>
                			</td>
                		</tr>
                		<tr align="right">
                			<td>
                				<input id="button" type="button" value="登陆" class="button" onclick="checkInput()"/>
                			</td>
                		</tr>
                	</table>
    <bgcolor="blue">
                </div>
                <div id="right">
                	<p>
                    	请从左侧输入登陆账号和密码登陆，如果遇到系统问题，请联系网络管理员。如果没有帐号，请联系网站管理员......	
                    </p>
                </div>
            </div>
        </div>
        <form id="form" action="forward.action" method="post" style="display: none;">
        	<input id="fid" name="id">
        	<input id="fpassword" name="password">
        </form>
    </body>
</html>